<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>对构造函数使用 new 操作符创建多个对象时，仅获取同一个单例对象呢。
	</body>
	<script>
		function ManageGame() {
			if(ManageGame._schedule) { // 判断是否已经有单例了
				return ManageGame._schedule
			}
			ManageGame._schedule = this
		}

		ManageGame.getInstance = function() {
			if(ManageGame._schedule) { // 判断是否已经有单例了
				return ManageGame._schedule
			}
			return ManageGame._schedule = new ManageGame()
		}

		const schedule1 = new ManageGame()
		const schedule2 = ManageGame.getInstance()

		console.log(schedule1 === schedule2)
	</script>

</html>